package com.atguigu.jxc.controller;

import com.atguigu.jxc.domain.ServiceVO;
import com.atguigu.jxc.entity.Supplier;
import com.atguigu.jxc.service.LogService;
import com.atguigu.jxc.service.SupplierService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

@RestController
@RequestMapping
public class SupplierController {
    @Autowired
    private SupplierService supplierService;


    /**
     * 分页查询供应商
     * @param page 当前页数
     * @param rows 每页显示的记录数
     * @param supplierName  供应商名字
     * @return
     */
    @PostMapping("/supplier/list")
    public Map<String, Object> supplierList(Integer page, Integer rows, String supplierName) {
        return supplierService.supplierList(page, rows, supplierName);
    }

    /**
     * 添加或修改供应商信息
     * @param supplier
     * @return
     */
   @PostMapping("/supplier/save")
    public ServiceVO supplierSave(Supplier supplier){
       return     supplierService.supplierSave(supplier);
   }

    /**
     * 删除供应商（支持批量删除）
     * @param ids
     * @return
     */
   @PostMapping("/supplier/delete")
    public ServiceVO supplierDelete(String ids){
       return supplierService.supplierDelete(ids);
   }
}
